import { request } from '@umijs/max';

export async function getTallyBookRecord(
  params: Partial<{
    pageSize: number;
    pageNo: number;
    count: number;
    importBizNo: string;
    status: string;
    alipayNickName: string;
    minCreateTime: string;
    maxCreateTime: string;
  }>,
) {
  return request('/merchant/safe-pay-book-account-order/search', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}

// 服务费明细
export async function getServiceFeeDetail(
  params: Partial<{
    id: string;
    type: string;
    pageNo: number;
    pageSize: number;
    count: number;
    createMinTime: string;
    createMaxTime: string;
  }>,
) {
  return request('/merchant/account-log/search', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}

// 发送验证码
export async function sendCaptcha() {
  return request('/common/check-code/user-withdraw', {
    method: 'get',
    getResponse: true,
  });
}
// 服务费提现列表查询
export async function getUserWithDrawRecord(params: {
  pageNo: number | string;
  pageSize: number | string;
}) {
  return request('/merchant/user-withdraw/search', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}
// 提交提现
export async function submitWithdraw(params: {
  realName: string;
  alipayNickName: string;
  amount: string;
  checkCode: string;
}) {
  return request('/merchant/user-withdraw/save', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}

// 记账本账户列表
export async function getTallyBookAccountList(
  params: Partial<{
    pageSize: number;
    pageNo: number;
    count: number;
    signStatus: string;
    auditStatus: string;
    alipayNickName: string;
  }>,
) {
  return request('/merchant/safe-pay-book-account/search', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}

// 支付宝企业认证
export async function aliPayEnterpriseAuthentication(params: {
  alipayName: string;
  alipayNickName: string;
}) {
  return request('/merchant/safe-pay/sign2', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}
// 记账本充值
export async function rechargeTallyBook(params: {
  alipayNickName: string;
  transAmount: string;
}) {
  return request('/merchant/safe-pay/charge', {
    method: 'post',
    getResponse: true,
    data: params,
  });
}

// 服务费充值
export async function rechargeServiceFee(params: {
  amount: string;
  billPayMethod: string;
  payChannelMoney: string;
  payMethod: number;
}) {
  return request('/merchant/charge-record/do-charge', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}

export async function getRechargeServiceFeeList(params: {
  id?: any;
  payStatus: string;
  pageNo: number;
  pageSize: number;
  createMinTime: string;
  createMaxTime: string;
}) {
  return request('/merchant/charge-record/search', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}

// 查询提现列表
export async function getWithdrawRecord(params: {
  pageNo: string | number;
  pageSize: string | number;
}) {
  return request('/merchant/user-withdraw/search', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}
